package com.crp.unitalinforbaseplat.app.core

import com.alibaba.fastjson.JSONObject

/**
 * @program: praduationppmsystem
 * @description:Message抽象类
 * @author:  chenzhicai
 * @create: 2018-09-01-18-05
 **/
abstract class AbstractMessage : Message {
    protected var json: JSONObject? = null

    init {

    }

    /**
     *@Description 返回当前的json数据
     *@Params
     *@return
     *@Author chenzhicai
     *@Date 2018/9/1
     *@Time 下午6:08
    **/
    protected fun currentJson(): JSONObject {
        return if (this.json == null) JSONObject() else this.json!!
    }

    /**
     *@Description 将当前的json转换成string
     *@Params
     *@return
     *@Author chenzhicai
     *@Date 2018/9/1
     *@Time 下午6:08
    **/
    override fun toString(): String {
        return this.buildJSON().toString()
    }
}